package patrol.mobile.com.mobilepatrol.adapter;

import android.content.Context;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.dl7.recycler.adapter.BaseQuickAdapter;
import com.dl7.recycler.adapter.BaseViewHolder;

import patrol.mobile.com.mobilepatrol.R;
import patrol.mobile.com.mobilepatrol.bean.TollAndServiceAreaBean;

/**
 * Created by K on 2018/9/13.
 * des:
 */
public class TollAndServiceAreaAdapter extends BaseQuickAdapter<TollAndServiceAreaBean> {
    private Context mContext;
    private String nBaseUrl;

    public TollAndServiceAreaAdapter(Context context, String baseUrl) {
        super(context);
        this.mContext = context;
        this.nBaseUrl = baseUrl;
    }

    @Override
    protected int attachLayoutRes() {
        return R.layout.item_toll_and_service_area;
    }

    @Override
    protected void convert(BaseViewHolder holder, TollAndServiceAreaBean item) {
        holder.setText(R.id.tv_title, item.getAreaName());
        holder.setText(R.id.tv_time, item.getSetDate());
        String replace = (nBaseUrl + item.getImage()).replace("\\", "/");
        Glide.with(mContext).load(replace).error(R.drawable.rc_image_error).into((ImageView) holder.getView(R.id.iv_img));
    }
}
